import React from 'react'
import qs from 'qs'
import { useLocation } from 'react-router-dom'
export default function News() {
    const location=useLocation()
    const{user}=qs.parse(location.search.split('?')[1])
    const newsList=location.state
  return (
    <div>
        <h1>hello</h1>
        <p>用户名是{user} 编号是{}</p>
        <ul>
            {
                newsList.map(item=>{
                    return <li key={item.id}>{item.name}</li>
                })
            }
        </ul>
    </div>
  )
}
